<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>心理问卷编辑</title>
<link href="${ctx}/css/layout.css" rel="stylesheet" type="text/css" />
<style type="text/css">
div { padding:0; list-style:none; }
</style>
<script type="text/javascript" src="${ctx}/js/jquery.EasyInsert-4.0.min.js"></script>
<script type="text/javascript" src="${ctx}/js/health/surveyQuestion.js"></script>
<script src="${ctx}/js/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function (){
if(1!=$("#flagId").val()){
       questions(1);
}

});
</script>
</head>
<body>
<form action="survey!save.action" method="post" id="surveyForm">
<div style="margin:0 10px">
<table>
<tr>
<td><label style="float:left;margin:0 0px">问卷名称:</label><input type="text" name="name" id="nameId" value="${name}"/></td>
<td><label style="float:left;margin:0 0px;">问卷描述:</label><input type="text" name="description" value="${description}" /></td>
<td><label style="float:left;margin:0 0px;">适用年级:</label><input type="text" name="grade" value="${grade}" /></td>
</tr>

<tr>
<td><label style="float:left;margin:0 0px;">年龄下限:</label><input type="text" name="lowerLimitAge" value="${lowerLimitAge}" /></td>
<td><label style="float:left;margin:0 0px;">年龄上限:</label><input type="text" name="upperLimitAge" value="${upperLimitAge}" /></td>
<td><label style="float:left;margin:0 0px;">适用性别:</label><s:select list="#{0:'男',1:'女'}" name="gender" id="" listKey="key" listValue="value" value="%{gender}" theme="simple" cssStyle="width:80px"></s:select></td>
</tr>
</table>
<br>
<input type="submit" value="保存" id="bc" onclick="save()" style="width:86px;float:right;margin:0 2px;"/>
<input type="button" id="bc" value="修改答案" onclick="editAnswer()" style="float:right;margin:0 2px;"/>
<input type="button" id="bc" onclick="addQuestions(seqNo)" value="新增问题" style="float:right;margin:0 1px;"/>
</div>
<input type="hidden" id="jsonId" name="jsonData" value="${jsonData}">
<input type="hidden" id="flagId" name="flag" value="${flag}">
<input type="hidden" id="judgmentting" name="judgmentting" value="${judgmentting}">
<p style="height:15px"></p>
<div id="massage" style="margin:0 15px;width:90%"></div>
<div style="OVERFLOW: auto;margin:0 15px; WIDTH: 94%; border:solid 0px;HEIGHT: 180px">
<div id="question" style="margin:0 15px;width:100%">
<s:if test="%{flag==1}">
<s:iterator value="questions" status="index">
<div style='margin:0 0px;width:90%;' id="fieldset${seqNo}">
<fieldset><legend align='top'><a href='#${seqNo}' id="${seqNo}" onclick="editQuestion(${seqNo},${type})">编辑</a>/<a href="#" onclick="removeSeqNo(${seqNo})">删除</a></legend>
	<br><s:if test="%{type}"><label id="seqNo${seqNo}">${seqNo}.</label><label id="subject${seqNo}">${question}</label><textarea cols="" rows="" id="question" name="" style="width:89%"></textarea></s:if>
		<s:else><label id="seqNo${seqNo}">${seqNo}.</label><label id="subject${seqNo}">${question}</label><div id="answerId${seqNo}">
		<s:radio name="" list="%{answers}" listKey="seqNo" listValue="answer" theme="simple" id="answer"/></div>&nbsp;&nbsp;&nbsp;</s:else>
</fieldset></div>		
	</s:iterator>
</s:if>
</div>
<div id="addQuestion" style="margin:0 15px;width:100%"></div>
<div></div>
</div>
<p style="height:0px"></p>
<div id="answerArea" style="">
<fieldset style="margin:0 15px;width:94%"><legend>问卷结果</legend>
<div style="float:left;">
<label style="float:left;margin:0 0px;">标准分下限:</label><input type="text" name="lowerStdScore" id="" value="${lowerStdScore}" size="10" style="float:left;margin:0 0px;"/>
<label style="float:left;margin:0 0px;">标准分上限:</label><input type="text" name="upperStdScore" id="" value="${upperStdScore}"size="10" style="float:left;margin:0 0px;"/>
<input type="button" id="bc" value="保存" onclick="saveAnswer()" style="width:86px;float:right;margin:0 10px;"/>
<input type="button" id="bc" value="新增选项" onclick="addItem()" style="float:right;margin:0 0px"/>
</div>

<div id="idItem" style="float:left;">

<s:if test="%{flag==1}">
<s:iterator value="judgingStds">
<div style="float:left;margin:0 15px; width:90%" id="idItem${seqNo}">
<label>总分下限:</label><input type="text" name="lowerLimit" id="lowerLimit${seqNo}" value="${lowerLimit}" size="10"/>
&nbsp;&nbsp;<label>总分上限:</label><input type="text" name="upperLimit" id="upperLimit${seqNo}" value="${upperLimit}" size="10" />
<label>显示结果:</label><input type="text" name="judgment" id="showResult${seqNo}" value="${judgment}"/>
<input type='button' id='sc' value='删除'  onclick="removeAnswer(${seqNo})" style="width:60px;margin:0 20px;"/>
</div>
</s:iterator>
</s:if> 
</div>
<s:else>
<div style="float:left;margin:0 15px; display:none;width:90%">
<label>总分下限:</label><input type="text" name="" id="lowerLimit" size="10"/>
&nbsp;&nbsp;<label>总分上限:</label><input type="text" name="" id="upperLimit" size="10" />
<label>显示结果:</label><input type="text" name="" id="showResult" value="答题结束 谢谢!"/>
</div>
</s:else>

<div style="float:left;">
&nbsp;
</div>
</fieldset>
</div>
</form>
</body>
</html>